//
//  UdpSingleton.h
//  Lead Show 3.0
//
//  Created by Maculish Ting on 14/10/31.
//  Copyright (c) 2014年 Leyard Optoelectronic Co.,Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AsyncUdpSocket.h"

#define DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \
static dispatch_once_t onceToken = 0; \
__strong static id sharedInstance = nil; \
dispatch_once(&onceToken, ^{ \
sharedInstance = block(); \
}); \
return sharedInstance; \


@protocol DisplayValueDelegate<NSObject>
// 向界面回调数据
-(void)displaySendScene:(NSData*)data;
@end

@interface UdpSingleton : NSObject<AsyncUdpSocketDelegate>{
    NSMutableData *bufferData;
    NSInteger *dataLength;
    NSInteger countTest;
}

@property (nonatomic,strong) AsyncUdpSocket *udpSocket;
@property (nonatomic,copy)   NSString       *udpHost;
@property (nonatomic,assign) UInt16         udpPort;

@property (nonatomic)id<DisplayValueDelegate>adelegate;

+(UdpSingleton*)shareInstance;

-(void) openUdpServerWithDefault;

-(void) openUdpServerWithHost:(NSString*)host withPort:(UInt16) port;

@end


